package com.bianguo.android.iocdemo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.bianguo.android.iocdemo.view.fragment.ParallaxFragment;

import java.util.ArrayList;

public class ParallaxAdapter extends FragmentPagerAdapter {

    private ArrayList<ParallaxFragment> fragments;

    public ParallaxAdapter(FragmentManager fm) {
        super(fm);
    }

    public ParallaxAdapter(FragmentManager fm, ArrayList<ParallaxFragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int i) {
        return fragments.get(i);
    }

    @Override
    public int getCount() {
        return fragments != null ? fragments.size() : 0;
    }
}
